[Dropzone] Enable multiple file uploads - #512
Conversation
e8a8a1e to
7105e52
Compare
7105e52 to
05ffafc
Compare
|
@tgalopin & @weaverryan Would you mind to review this PR? 😄 |
weaverryan
left a comment
There was a problem hiding this comment.
Thanks for this! I have some questions - either we're not (yet) quite supporting the "preview" for multiple files, or I'm missing it!
Cheers :)
| {%- set dataController = (attr['data-controller']|default('') ~ ' symfony--ux-dropzone--dropzone')|trim -%} | ||
| {%- set attr = attr|merge({ 'data-controller': '', class: (attr.class|default('') ~ ' dropzone-input')|trim}) -%} | ||
|
|
||
|
|
There was a problem hiding this comment.
minor, but we can revert this change
| } | ||
|
|
||
| this._dispatchEvent('dropzone:change', file); | ||
| this._dispatchEvent('dropzone:change', event.target.files); |
There was a problem hiding this comment.
Let's not this in the CHANGELOG - that's a minor BC break.
| this.previewImageTarget.style.display = 'none'; | ||
| this.previewImageTarget.style.backgroundImage = 'none'; | ||
| this.previewFilenameTarget.textContent = ''; | ||
| document.querySelectorAll('.dropzone-preview-image-container').forEach((e) => e.remove()); |
There was a problem hiding this comment.
Sorry if I'm missing it, where/what is creating this .dropzone-preview-image-container element?
|
|
||
| // Show the filename in preview | ||
| this.previewFilenameTarget.textContent = file.name; | ||
| this.previewTarget.style.display = 'flex'; |
There was a problem hiding this comment.
I haven't tried the code yet, but how does this work with multiple files? It looks like if I attach multiple files, only the last one's filename would show up (it would override the earlier ones). Or very possibly I am missing a detail :)
|
After a small conversation with @weaverryan on Slack I plan to add the following options to this component:
|
806cc8a to
3e47174
Compare
weaverryan
left a comment
There was a problem hiding this comment.
Hi!
I played with this locally, but it doesn't look like multiple previews show up - just the one. Is that my mistake? Or do we still need a good deal more work - like to have potentially multiple "preview" areas instead of just one?
Thanks!
| numberOfFiles: Number | ||
| } | ||
|
|
||
| readonly numberOfFilesValue: number; |
There was a problem hiding this comment.
It doesn't look like this is used?
| {%- set dataController = (attr['data-controller']|default('') ~ ' symfony--ux-dropzone--dropzone')|trim -%} | ||
| {%- set attr = attr|merge({ 'data-controller': '', class: (attr.class|default('') ~ ' dropzone-input')|trim}) -%} | ||
|
|
||
|
|
| 'attr' => [ | ||
| 'placeholder' => 'Drag and drop or browse', | ||
| ], | ||
| 'multiple' => false, |
There was a problem hiding this comment.
Is that needed? It's already the default of the parent type
|
Hi! We need multiple file upload. Who can help with this? I understand daFish has been developing it, but we need it live? Who on the Symfony development team can help us to work with this? |
|
After some thoughts I'm not going to finish this. It is based upon the work of @yassinehamouten and I'd rather propose to go with uppy.io. |
|
sorry to pick up on the old PR. But the above mentioned missing preview on more than one file seems still not to be working. I tried the current version of UX Dropzone, the multiple in the form element works. It accepts multiple files and posts them along with the form. But the preview of more than one file and the capability of adding more files seems also be missing. Is there any trick i am missing? |
This change adds the posibility to upload multiple files using the Dropzone component. This is based on the work by @yassinehamouten.